Skip to content

Add --quiet flag to x.py and bootstrap to suppress output#154616

Open
erickt wants to merge 1 commit intorust-lang:mainfrom
erickt:quiet
Open

Add --quiet flag to x.py and bootstrap to suppress output#154616
erickt wants to merge 1 commit intorust-lang:mainfrom
erickt:quiet

Conversation

@erickt
Copy link
Copy Markdown
Contributor

@erickt erickt commented Mar 31, 2026

This adds a --quiet flag to x.py and bootstrap to suppress some of the output when compiling Rust. It works by passing the flag down to the underlying cargo, cmake, ninja, or make processes.

This adds a `--quiet` flag to x.py and bootstrap to suppress some of the
output when compiling Rust. It works by passing the flag down to the
underlying cargo, cmake, ninja, or make processes.
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 31, 2026

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 31, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 31, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @Mark-Simulacrum

@jieyouxu
Copy link
Copy Markdown
Member

I can only look into these this weekend, but cc also #154587

(It would be nice to be careful that we don't use --quiet to mean different things)

@erickt
Copy link
Copy Markdown
Contributor Author

erickt commented Mar 31, 2026

Ha! What a coincidence. I’m certainly intending to have the same semantics as that PR, so I think they should be compatible with each other. I’m happy to wait for it to land since it beat me by a few hours, then I can match the style with whatever you finalize on.

@jieyouxu
Copy link
Copy Markdown
Member

(I think either one can land first, I was just remarking just in case we somehow have --quiet do two entirely different things which would be very confusing, but doesn't seem like the case)

@Mark-Simulacrum Mark-Simulacrum removed their assignment Apr 4, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 5, 2026

☔ The latest upstream changes (presumably #154824) made this pull request unmergeable. Please resolve the merge conflicts.

@jieyouxu
Copy link
Copy Markdown
Member

jieyouxu commented Apr 5, 2026

Thanks for the patience. So I looked at both this PR and the #154587, and I think I would say:

  • We keep using --quiet in this PR for the more general-purpose operation of suppressing certain build outputs, which seems more common.
  • We'll use something more specific like --verbose-run-make-subprocess-output for the other use case next doors, because that use case is very niche.

I'll review this PR now.

@jieyouxu jieyouxu self-requested a review April 5, 2026 08:25
Copy link
Copy Markdown
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Have a question and a suggestion.

View changes since this review

"--warnings", choices=["deny", "warn", "default"], default="default"
)
parser.add_argument("-v", "--verbose", action="count", default=0)
parser.add_argument("-q", "--quiet", action="store_const", const=-1, dest="verbose")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion: hm, I thought about this a bit, I was wondering why this was using store_const and not store_{true,false}, and it's because this is the minimal change to repurpose verbose args/fields in bootstrap.py. Otherwise, you'd need to change all the if self.verbose: and friends to also do if self.verbose and not self.quiet etc.

I'm slightly conflicted, because now "verbose" is more like

                suppress output       increasing verbosity
                ◄───────────────── ─────────────────────────►  
                quiet             0             -v        -vv  ...
verbose :=      -1                0              1         2   ...

but then again, it's not really the end of the world. We may want to leave a comment here re. the intention / recycling of verbose tho.

Comment on lines 1127 to +1130
# verbose cargo output is very noisy, so only enable it with -vv
args.extend("--verbose" for _ in range(self.verbose - 1))
if self.verbose < 0:
args.append("--quiet")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question [MUTEX 1/2]: hm, this combination is somewhat interesting. Does cargo support --quiet --verbose?

EDIT: no, you cannot:

$ cargo check --quiet --verbose
error: cannot set both --verbose and --quiet

Can we also:

  • Either do an exclusivity check here, or
  • Reject the combination of both --verbose/-vv et al. with --quiet during arg parsing?

I kinda don't want to have to wait until we reach cargo to know that this is not a valid combo.

@@ -1276,6 +1278,7 @@ def parse_args(args):
"--warnings", choices=["deny", "warn", "default"], default="default"
)
parser.add_argument("-v", "--verbose", action="count", default=0)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion [MUTEX 2/2]:

Looks like Python's argparse allows us to use "mutually-exclusive subgroups" (see https://docs.python.org/3/library/argparse.html#mutual-exclusion), I would suggest making --verbose and --quiet mutually exclusive for the reasons described in [MUTEX 1/2].

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: the general idea of a --quiet flag seems reasonable to me. Can you say more on your use case? I want to learn more re. what you intend to be using --quiet for. Is it just to suppress some of the "non-critical messages" for local dev?

I ask because some of the warnings can indicate real, genuine problems.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 5, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 5, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants